import request from '@/utils/request'

// 查询个人商品信息列表
export function listUserCommodity(query) {
  return request({
    url: '/campus/userCommodity/list',
    method: 'get',
    params: query
  })
}

// 查询个人商品信息详细
export function getUserCommodity(comId) {
  return request({
    url: '/campus/userCommodity/' + comId,
    method: 'get'
  })
}

// 新增个人商品信息
export function addUserCommodity(data) {
  return request({
    url: '/campus/userCommodity',
    method: 'post',
    data: data
  })
}

// 修改个人商品信息
export function updateUserCommodity(data) {
  return request({
    url: '/campus/userCommodity',
    method: 'put',
    data: data
  })
}

// 删除个人商品信息
export function delUserCommodity(comId) {
  return request({
    url: '/campus/userCommodity/' + comId,
    method: 'delete'
  })
}

// 根据id查询商品类别
export function getCommType(typeId) {
  return request({
    url: '/campus/userCommodity/getType/' + typeId,
    method: 'get'
  })
}

// 根据typeName查询商品类别详细
export function getCommTypeByTypeNameLike(typeName) {
  return request({
    url: '/campus/userCommodity/getCommTypeByTypeNameLike/' + typeName,
    method: 'get'
  })
}

// 查询类别列表
export function listCommType(query) {
  return request({
    url: '/campus/commType/list',
    method: 'get',
    params: query
  })
}
